<?php

//First we set up parameters
$searchpath = JPATH_SITE.DS."images".DS."slideshow";
 
//Now we read all jpg files and put them in an array.
//JFolder::files($path, $filter = '.', $recurse, $fullpath , $exclude);

$jpg_files = JFolder::files($searchpath, '.jpg',true);
$generateRuta = function($value) {
    return '<img src="/images/slideshow/'.$value.'?v=1" width="900" height="485" class="photo" />' ;
};
$jpg_files=array_map($generateRuta, $jpg_files);
$ul="<ul>";
$div="";
foreach($jpg_files as $index =>$img){
    $index=$index+1;
    $ul.=sprintf('<li><a href="#tabs-%d">%d</a></li>',$index,$index);
    $div.=sprintf('<div id="tabs-%d">%s</div>',$index,$img);    
}
$ul.="</ul>".$div;
echo $ul;
exit();
?>
